import sys

def xprint(msg):
    try:
        print('do try')
        raise Exception
    except:
        print('do except')
        print(msg)
        f = sys.exc_info()[2].tb_frame.f_back

    print('%s[%s]: %s' % (f.f_code.co_filename, str(f.f_lineno), msg))

if __name__ == '__main__':
    #xprint()
    xprint('hello world')